// pages/storeinfo/storeinfo.js
var checked = [true, false, false, false, false, false, false, false, false, false, false];
Page({

  /**
   * 页面的初始数据
   */
  data: {
    checked: checked,
    allChecked:true,
    checkedCategory:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      mername:'宝宝张的店'
    })
    wx.setNavigationBarTitle({
      title: that.data.mername //页面标题为路由参数
    })
  },
  // 搜索商品
  searchGoods:function(e){
    wx.navigateTo({
      url: '/pages/searchresult/searchresult',
    })
  },
  
  clickCategory:function(e){
    var that = this;
    var index = e.currentTarget.dataset.index;
    if(!that.data.checked[index]){
      that.data.checked[index] = true
    }
    that.changeOldchecked(index);
    that.setData({
      checked: that.data.checked
    })
  },
  changeOldchecked: function (newIndex){
    var that = this;
    for(var i=0;i<that.data.checked.length;i++){
      if (that.data.checked[i] && i != newIndex){
        that.data.checked[i] = false;
        that.setData({
          checked:that.data.checked
        })
        break;
      }
    }
  },
  // 跳转店铺信息
  todetail:function(){
    wx.navigateTo({
      url: '/pages/storemsg/storemsg',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})